#ifndef CAMPAIGNDEFINES_H
#define CAMPAIGNDEFINES_H


#include "dtwenty_global.h"
#include "campaign.h"
#include "skill.h"
#include "feat.h"
#include "specialability.h"
#include "characterclass.h"


#include <datasuite.h>


class DTWENTYSHARED_EXPORT CampaignSuiteItem : public DataSuite
{
    Q_OBJECT

public:

    CampaignSuiteItem(const int childType, Campaign* parent = 0) :
        DataSuite(parent),
        CHILD_TYPE(childType)
    {
    }

    CampaignSuiteItem(const CampaignSuiteItem& other) :
        DataSuite(other),
        CHILD_TYPE(other.CHILD_TYPE)
    {
    }

    int childType() const
    {
        return CHILD_TYPE;
    }

    QString childTypeName() const
    {
        return QMetaType::typeName(CHILD_TYPE);
    }

    DataContainer* createChild();

protected:

    const int CHILD_TYPE;
};


class DTWENTYSHARED_EXPORT CharacterClasses : public CampaignSuiteItem
{
    Q_OBJECT

public:

    Q_INVOKABLE CharacterClasses(Campaign* parent = 0) :
        CampaignSuiteItem(qRegisterMetaType<CharacterClass>("Character Class"), parent)
    {
        setName(tr("Character Classes"));
    }

    CharacterClasses(const CharacterClasses& other) :
        CampaignSuiteItem(other)
    {
    }

};

Q_DECLARE_METATYPE(CharacterClasses*)



class DTWENTYSHARED_EXPORT CampaignSkills : public CampaignSuiteItem
{
    Q_OBJECT

public:

    Q_INVOKABLE CampaignSkills(Campaign* parent = 0) :
        CampaignSuiteItem(qRegisterMetaType<Skill>("Skill"), parent)
    {
        setName(tr("Skills"));
    }

    CampaignSkills(const CampaignSkills& other) :
        CampaignSuiteItem(other)
    {
    }

};

Q_DECLARE_METATYPE(CampaignSkills*)


class DTWENTYSHARED_EXPORT CampaignFeats : public CampaignSuiteItem
{
    Q_OBJECT

public:

    Q_INVOKABLE CampaignFeats(Campaign* parent = 0) :
        CampaignSuiteItem(qRegisterMetaType<Feat>("Feat"), parent)
    {
        setName(tr("Feats"));
    }

    CampaignFeats(const CampaignFeats& other) :
        CampaignSuiteItem(other)
    {
    }

};

Q_DECLARE_METATYPE(CampaignFeats*)


class DTWENTYSHARED_EXPORT CampaignSpecials : public CampaignSuiteItem
{
    Q_OBJECT

public:

    Q_INVOKABLE CampaignSpecials(Campaign* parent = 0) :
        CampaignSuiteItem(qRegisterMetaType<SpecialAbility>("Special Ability"), parent)
    {
        setName(tr("Specials"));
    }

    CampaignSpecials(const CampaignSpecials& other) :
        CampaignSuiteItem(other)
    {
    }

};

Q_DECLARE_METATYPE(CampaignSpecials*)


//class DTWENTYSHARED_EXPORT CampaignAttributes : public DataSuite
//{
//    Q_OBJECT

//    Q_ENUMS(Attribute)

//public:

//    enum Attribute
//    {
//        Strength = 0,
//        Dexterity,
//        Constitution,
//        Intelligence,
//        Wisdom,
//        Charisma
//    };

//    Q_INVOKABLE CampaignAttributes(Campaign* parent = 0) :
//        DataSuite(parent)
//    {
//        setName(tr("Attributes"));
//    }

//    CampaignAttributes(const CampaignAttributes& other) :
//        DataSuite(other)
//    {
//    }

//    virtual QVariant value(int field, int role) const
//    {
//        if (role != Qt::DisplayRole)
//        {
//            return QVariant();
//        }

//        const QMetaObject* meta = metaObject();
//        int index = meta->enumeratorCount()-1;
//        if (index < 0)
//        {
//            return QVariant();
//        }

//        QMetaEnum en = meta->enumerator(index);

//        return en.key(field);

//    }

//};

//Q_DECLARE_METATYPE(CampaignAttributes*)

#endif // CAMPAIGNDEFINES_H
